<template>
  <div>
    <Row>
      <Col span="24">
      <Card>
        <div style="position:relative;">
          <iframe
            id="iframe"
            :height="iframeHeight"
            :src="go"
            frameborder="0"
            scrolling="auto"
            width="100%"
          ></iframe>
        </div>
      </Card>
      </Col>
    </Row>
  </div>
</template>

<script>
export default {
  name: 'Monitor',
  data() {
    return {
      loading: false,
      go: '',
      iframeHeight: 0
    }
  },
  computed: {},
  watch: {
    $route() {
      this.initUrl()
    }
  },
  mounted() {
    this.initUrl()
  },
  methods: {
    handleGo() {
      this.go = this.url
    },
    initUrl() {
      const url = this.$route.meta.url
      if (url !== null && url !== undefined) {
        this.go = url
        this.iframeHeight = this.$parent.$el.clientHeight - 160
        const iframe = document.getElementById('iframe')
        if (iframe.attachEvent) {
          iframe.attachEvent('onload', function () {
          })
        } else {
          iframe.onload = function () {
          }
        }
      }
    }
  }
}
</script>

<style>
</style>
